package com.tencent.iov.cowin.befsale.clue.controller.cus.assembler;

import com.tencent.iov.cowin.befsale.clue.controller.cus.vo.request.AddCustomerBehaviorRequest;
import com.tencent.iov.cowin.befsale.clue.controller.cus.vo.request.UpdateCustomerBehaviorRequest;
import com.tencent.iov.cowin.befsale.clue.domain.cus.po.CustomerBehavior;
import com.software.boot.common.model.dao.BaseAssembler;
import com.software.boot.common.model.rest.BaseRequest;
import com.software.boot.common.model.rest.BaseResponse;
import com.software.common.config.SearchLocalHeader;
import com.software.common.enums.SCRMRequestHeaderEnum;
import lombok.extern.slf4j.Slf4j;

import java.util.Date;

/**
 * @Author: xiamu
 * @Date: 2022-01-11 16:00:54
 * @Description: 客户行为标签统计表（线索中心需求建表）适配器，负责vo<->entity、vo<->po的转换和必要的参数检查，行为
 */
@Slf4j
public class CustomerBehaviorAssembler extends BaseAssembler<BaseResponse, BaseRequest, CustomerBehavior> {
    public static AddCustomerBehaviorRequest initAddCustomerBehaviorRequest(AddCustomerBehaviorRequest request){
        request.setCorpId(SearchLocalHeader.getHeader(SCRMRequestHeaderEnum.HEADER_CORP_ACCOUNTID.getCode()));
        request.setTenantId(SearchLocalHeader.getHeader(SCRMRequestHeaderEnum.HEADER_TENANTID.getCode()));
        request.setDealerId(SearchLocalHeader.getHeader(SCRMRequestHeaderEnum.HEADER_DEALER_ID.getCode()));
        request.setCreatedBy(SearchLocalHeader.getHeader(SCRMRequestHeaderEnum.HEADER_EMP_ID.getCode()));
        request.setUpdatedBy(SearchLocalHeader.getHeader(SCRMRequestHeaderEnum.HEADER_EMP_ID.getCode()));
        request.setCreatedName(SearchLocalHeader.getHeader(SCRMRequestHeaderEnum.HEADER_EMP_NAME.getCode()));
        request.setUpdatedName(SearchLocalHeader.getHeader(SCRMRequestHeaderEnum.HEADER_EMP_NAME.getCode()));
        request.setCreatedTime(new Date());
        request.setUpdatedTime(new Date());
        return request;
    }

    public static UpdateCustomerBehaviorRequest initUpdateCustomerBehaviorRequest(UpdateCustomerBehaviorRequest request){
        request.setUpdatedBy(SearchLocalHeader.getHeader(SCRMRequestHeaderEnum.HEADER_EMP_ID.getCode()));
        request.setUpdatedName(SearchLocalHeader.getHeader(SCRMRequestHeaderEnum.HEADER_EMP_NAME.getCode()));
        request.setUpdatedTime(new Date());
        return request;
    }

}
